Skip to content

Add support for protobuf-py#482

Open
anuraaga wants to merge 5 commits into
bufbuild:mainfrom
anuraaga:protobuf-py
Open

Add support for protobuf-py#482
anuraaga wants to merge 5 commits into
bufbuild:mainfrom
anuraaga:protobuf-py

Conversation

@anuraaga

@anuraaga anuraaga commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Fixes #339

This rewrites the protovalidate rules engine to protobuf-py, adding native support for it. google.protobuf compatibility is preserved with an optional dependency on it - we just copy into protobuf-py dynamic messages to keep to a single engine.

The change is largely mechanical, from one descriptor API to a different one, but is by nature all in so it is a large diff.

This also executes our plan to take advantage of protobuf-py to finally fix #339, a user does not have to bring in their own validate proto gencode for this library to work as we just vendor it in. If a user also vendors it in, no problem since no global descriptor pool conflicts.

@anuraaga anuraaga requested a review from ajeetdsouza July 2, 2026 07:06
Comment on lines +17 to +18
from google.protobuf import descriptor
from google.protobuf import message as google_message

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from google.protobuf import descriptor
from google.protobuf import message as google_message
from google.protobuf import descriptor as google_descriptor
from google.protobuf import message as google_message

There are a bunch of other places we're importing google-protobuf, would be good to do something like this everywhere for clarity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Generated buf.validate message are not part of the pypi package

2 participants